package demo3;

public class Macbook implements IUSB{

    @Override
    public void openDevice() {
        System.out.println("打开电脑...");
    }

    @Override
    public void closeDevice() {
        System.out.println("关闭电脑...");
    }

    public void useDevice(IUSB iusb){
        iusb.openDevice();
        if(iusb instanceof Mouse){
            Mouse mouse = (Mouse) iusb;
            mouse.click();
        }
        if(iusb instanceof Keyboard){
            Keyboard keyboard = (Keyboard) iusb;
            keyboard.inPut();
        }
        iusb.closeDevice();

    }
}
